package com.food.restaurantpro.utils;

import android.content.Context;
import android.content.SharedPreferences;

public class Prefs {
	SharedPreferences prefs;
	Context context;
	public static final String SHAREDPREFERENCES_NAME = "com_food_restaurant_pref";
	
	//For User Info
	public static final String KEY_USER_INFO_ID 			= "KEY_USER_INFO_ID";
	public static final String KEY_USER_INFO_GENERATE_ID	= "KEY_USER_INFO_GENERATE_ID";
	public static final String KEY_USER_INFO_NAME 			= "KEY_CUSTOMER_NAME";
	public static final String KEY_USER_INFO_EMAIL 			= "KEY_CUSTOMER_EMAIL";
	public static final String KEY_USER_INFO_ADDRESS 		= "KEY_CUSTOMER_ADDRESS";
	public static final String KEY_USER_INFO_AVATAR_URL 	= "KEY_CUSTOMER_AVATAR_URL";
	public static final String KEY_USER_INFO_PHONE			= "KEY_USER_INFO_PHONE";
	//For About Us
	public static final String KEY_ABOUT_US_TITLE			= "KEY_ABOUT_US_TITLE";
	public static final String KEY_ABOUT_US_CONTENT			= "KEY_ABOUT_US_CONTENT";
	public static final String KEY_ABOUT_US_IMAGE_URL		= "KEY_ABOUT_US_IMAGE_URL";

	//ngay-gio hien tai
	public static final String KEY_CURRENT_DAY = "KEY_CURRENT_DAY"; // Ngay hien tai
	public static final String KEY_CURRENT_TIME = "KEY_CURRENT_TIME"; // Gio hien tai
	
	//ngay-gio update promotions
	public static final String KEY_DAY_UPDATE_PROMOTIONS = "KEY_DAY_UPDATE_PROMOTIONS"; //Ngay update promotions
	public static final String KEY_TIME_UPDATE_PROMOTIONS = "KEY_TIME_UPDATE_PROMOTIONS"; //Gio update promotions
	
	//ngay-gio update food list
	public static final String KEY_DAY_UPDATE_FOODS = "KEY_DAY_UPDATE_FOODS"; // Ngay update food list
	public static final String KEY_TIME_UPDATE_FOODS = "KEY_TIME_UPDATE_FOODS"; // Gio update food list
	
	//lat long of my location
	public static final String KEY_MY_LAT = "KEY_MY_LAT";
	public static final String KEY_MY_LONG = "KEY_MY_LONG";
	
	
	public static final String KEY_FOOD_FRAGMENT_IS_SHOWING_LISTVIEW = "KEY_FOOD_FRAGMENT";
	
	
	//ngay gio dat pre-order lan cuoi
	public static final String KEY_LAST_YEAR_PRE_ORDER = "KEY_LAST_YEAR_PRE_ORDER";
	public static final String KEY_LAST_MONTH_PRE_ORDER = "KEY_LAST_MONTH_PRE_ORDER";
	public static final String KEY_LAST_DAY_PRE_ORDER = "KEY_LAST_DAY_PRE_ORDER";
	public static final String KEY_LAST_HOUR_PRE_ORDER = "KEY_LAST_HOUR_PRE_ORDER";
	public static final String KEY_LAST_MINUTE_PRE_ORDER = "KEY_LAST_MINUTE_PRE_ORDER";
	
	public Prefs(Context ctx) {
		// TODO Auto-generated constructor stub
		this.context = ctx;
		prefs = ctx.getSharedPreferences(SHAREDPREFERENCES_NAME,
				Context.MODE_PRIVATE);
	}

	public void putBooleanValue(boolean value, String KEY) {

		prefs.edit().putBoolean(KEY, value).commit();
	}

	public boolean getBooleanValue(boolean defvalue, String KEY) {

		return prefs.getBoolean(KEY, defvalue);
	}

	public void putStringValue(String value, String KEY) {

		prefs.edit().putString(KEY, value).commit();
	}

	public String getStringValue(String defvalue, String KEY) {

		return prefs.getString(KEY, defvalue);
	}

	public void putIntValue(int value, String KEY) {

		prefs.edit().putInt(KEY, value).commit();
	}

	public int getIntValue(int defvalue, String KEY) {

		return prefs.getInt(KEY, defvalue);
	}

	public void putLongValue(long value, String KEY) {

		prefs.edit().putLong(KEY, value).commit();
	}

	public long getLongValue(long defvalue, String KEY) {

		return prefs.getLong(KEY, defvalue);
	}

	public void putFloatValue(float value, String KEY) {

		prefs.edit().putFloat(KEY, value).commit();
	}

	public float getFloatValue(float defvalue, String KEY) {

		return prefs.getFloat(KEY, defvalue);
	}

	public void removeValue(String KEY) {

		prefs.edit().remove(KEY).commit();
	}
}
